56 - Lecture_13_3_Discretization [ID:39968]
50 von 136 angezeigt

Next up is discretization. And as a global constant, so to speak, we fix some n in the

natural numbers and we say n has to be larger than 2. But much larger than 2, we will choose

a thousand later. And then we first discretize this interval from 0 to 1. This will become

a grid. So this is 0, this is 1. We will put n points here. So n points in total. This

means that the distance between two consecutive points will be h, where h is 1 over n. So

let's say delta x or xi plus 1 minus xi. This is h, which is equal to 1 over n. And those

xi, I'm calling them x0 tilde because I will change the labels later. This will be xn minus

1 tilde. So those xi tilde, where i goes from 0 to n minus 1, are equidistant, this is an

equidistant grid on and including the boundaries on 0, 1. And what is a formula for that? You

can write xi tilde is equal to i divided by n minus 1. Then indeed x0 tilde is 0 and xn

minus 1 tilde is 1 and the rest is equidistantly distributed along this line. Now the next

step is to realize that we don't need those boundary points. We don't need them for the

temperature function, we don't need them for the heat source. So the temperature is fixed

on those points. So we don't have to consider those boundary points for the temperature.

And what I failed to write here is that this differential equation only holds in the interior

of this interval. So we actually don't need the values for the heat source on the boundary

points as well. So we don't care about those two. So we remove x0 tilde and xn minus 1

tilde. And this then leads to a new grid xi without the tilde, where i goes from 0 to

n minus 3. So I don't want to drop the 0 in the n minus 1 because Python uses labeling

starting with 0. So I'm relabeling this where xi is equal to xi tilde plus 1. So this is

i plus 1 divided by n minus 1. So this gives us this grid here without the boundary. Well,

these are not equidistant, but you get the point. So x0, x1, and xn minus 3, which means

n minus 2 points in total. So n minus 2 will always be the number or the degrees of freedom

in this model. Of course, I could have started with n plus 2 here. So with n degrees of freedom.

But then this h is more complicated because then it's h is 1 over n plus 2. I didn't want

that. So it's just pick any convention and stick to it. So here h is 1 over n, and you

have n minus 2 points in total. We don't include the boundary points. And this is our grid.

OK. So this is what the discretization of space looks like. And then we define ui as

u of xi. So this is the relation of the heat source in those interior points. And those

pi will be defined as p of xi. So this leads us to u and p being vectors in Rn minus 2.

So this will be our discretization of the functions u and p. So I'm overloading notation

here. Maybe I should write something like u bar for the vectors and u without bars for

the functions. But I'm not doing that. You won't get the point. Because from that point

on, I will not look at functions anymore. So on the project sheet, I'm a bit more careful.

And those two are distinguished. But I'm dropping this distinction for now. So u and p will

always be vectors from now on and not functions. So that was the easy part. Now we have to

discretize this relationship between p and u. This involves this integral here. And in

order to do this, we first have to think about how to discretize integration. And there is

no one way to do this. I will make a suggestion. You can also do something else. But I will

do the trapezoid quadrature formula. Trapezoid rule of numerical integration. And you've

probably seen that in the numerical analysis class or something like that. So if we are

interested in integrating such a function here, let's say this is f, then the integral

f of x dx from 0, well let's put a y here to keep this consistent. Then this is approximately

the following. So let's say we pick a grid point xi here. And let's say we pick x0 here.

So this is x0. We have more grid points. x1 and so on. This is the grid point xi. We only

evaluate this integral on grid points. And what we do is we have those point-wise evaluations

and we approximate the function by trapezoids, which look like that. So we just put those

straight lines in here. And well, for example, let's maybe do x1 first. Let's make this a

bit nicer. So the integral from x0 to x1 of f y dy, this is approximately h, which is

the difference between x1 and x0, times x0 plus x1 half. This is exactly the area of

Teil einer Videoserie :

Zugänglich über

Offener Zugang

Dauer

00:24:49 Min

Aufnahmedatum

2022-01-13

Hochgeladen am

2022-01-13 13:26:04

Sprache

en-US

Einbetten
Wordpress FAU Plugin
iFrame
Teilen